//import org.apache.http.NameValuePair;
//import org.apache.http.client.entity.UrlEncodedFormEntity;
//import org.apache.http.client.methods.HttpGet;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.impl.client.DefaultHttpClient;
//import org.apache.http.message.BasicNameValuePair;
//import org.apache.http.params.CoreConnectionPNames;
//import org.apache.http.params.CoreProtocolPNames;
//import org.apache.http.util.EntityUtils;
//import org.apache.log4j.spi.LoggerFactory;
//import org.json.Cookie;
//import org.json.JSONObject;
//
//import java.io.*;
//import java.net.CookieStore;
//import java.net.HttpURLConnection;
//import java.net.MalformedURLException;
//import java.net.URL;
//import java.net.http.HttpResponse;
//import java.text.SimpleDateFormat;
//import java.util.*;
//import java.util.logging.Logger;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//public class Test {
//         private static CookieStore cookieStore;
//
//             public static void main(String[] args) throws IOException {
//
//        URL url = new URL("http://localhost:8080/lbs_server/print_session.jsp");
//
//
//
//        HttpURLConnection conn = (HttpURLConnection)url.openConnection();
//
//    }
//
//    public static Map<String,String> getSettings(String file){
//        Map<String, String> settingMap = new LinkedHashMap<String, String>();
//        File settingFile = new File(file);
//        String str;
//        try {
//            BufferedReader bf = new BufferedReader(new FileReader(settingFile));
//
//            while ((str = (bf.readLine()))!= null) {
//                if (str.contains("=")) {
//                    String[] split = str.split("=");
//                    settingMap.put(split[0], split[1]);
//                }
//            }
//
//        } catch (FileNotFoundException e) {
//            System.out.println("抱歉，配置文件没有被找到，请检查相关文件路径是否填写正确");
//        } catch (IOException e) {
//            System.out.println("抱歉出现未知错误，请稍后再试");
//        }
//        return settingMap;
//    }
//
//
//        /**
//         *
//         * @param httpUrl
//         *            地址
//         * @param paramMap
//         *            参数
//         *
//         */
//        public static String loginPost(String httpUrl, Map<String, Object> paramMap) throws Exception {
//
//
//            // 创建httpPost
//            HttpGet httpget = new HttpGet(httpUrl);
//
//
//            String response;
//            DefaultHttpClient httpClient = null;
//            try {
//                httpClient = new DefaultHttpClient();
//                String contentCharset = CoreProtocolPNames.HTTP_CONTENT_CHARSET;
//                String soTimeOut = CoreConnectionPNames.SO_TIMEOUT;
//                String connectTimeOut = CoreConnectionPNames.CONNECTION_TIMEOUT;
//                httpClient.getParams().setParameter(contentCharset, "utf-8");
//                httpClient.getParams().setParameter(soTimeOut, 60000);
//                httpClient.getParams().setParameter(connectTimeOut, 60000);
//
//                HttpResponse httpResponse = httpClient.execute(httpPost);
//
//                // 获得返回结果
//                response = EntityUtils.toString(httpResponse.getEntity(), UcopUtils.UCOP_DEFAULT_CHARSET);
//
//                // 获得cookie并存取
//                this.cookieStore = httpClient.getCookieStore();
//                List<Cookie> cookieList = this.cookieStore.getCookies();
//                for (Cookie cookie : cookieList){
//                    String name =cookie.getName();
//                    String value = cookie.getValue();
//                    log.info("登陆成功，cookie name = " + name + ", cookie value = " + value);
//                }
//                if (log.isInfoEnabled()) {
//                    log.info("响应内容=" + response);
//                }
//                return response;
//            } catch (Exception e) {
//                log.error("HttpPost请求失败：" + e.getMessage(), e);
//                throw new RuntimeException("HttpPost请求失败：" + e.getMessage(), e);
//            } finally {
//                if (null != httpClient) {
//                    httpClient.getConnectionManager().shutdown();
//                }
//            }
//
//
//}
